package com.silverhaze.diamond.client.utils.db.dev;

import com.silverhaze.diamond.common.entity.SystemUser;
import com.silverhaze.diamond.common.entity.Customer;
import com.silverhaze.diamond.common.entity.Detail;
import com.silverhaze.diamond.common.entity.Service;
import com.silverhaze.diamond.client.utils.db.ServiceDataSource;

import java.util.Scanner;

/**
 * Created by Ivan Babanin (15:16:43 09.06.2008)
 * This part of code is strictly confidential.
 * © Magnificent Software Inc.
 */
public class KillDB {
    public static void main(String[] args) {
        System.out.println("Enter tables first chars:");
        Scanner in = new Scanner(System.in);
        String input = in.nextLine().toUpperCase();

        if (input.contains("D")) {
            ServiceDataSource.getInstance().cleanAllByClass(Detail.class);
        }

        if (input.contains("U")) {
            ServiceDataSource.getInstance().cleanAllByClass(SystemUser.class);
        }

        if (input.contains("C")) {
            ServiceDataSource.getInstance().cleanAllByClass(Customer.class);
        }

        if (input.contains("S")) {
            ServiceDataSource.getInstance().cleanAllByClass(Service.class);
        }
    }
}

